package com.fc.mall.service.impl;

import com.fc.mall.mapper.SmsIntegrationSettingMapper;
import com.fc.mall.mapper.UmsIntegrationConsumeSettingMapper;
import com.fc.mall.model.SmsIntegrationSetting;
import com.fc.mall.model.UmsIntegrationConsumeSetting;
import com.fc.mall.service.SmsIntegrationSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by sunny on 2019/10/14.
 */
@Service
public class SmsIntegrationSettingServiceImpl implements SmsIntegrationSettingService {

    @Autowired
    private SmsIntegrationSettingMapper integrationSettingMapper;

    @Autowired
    private UmsIntegrationConsumeSettingMapper integrationConsumeSettingMapper;

    private final static Long DEFAULT_INTEGRATION_SETTING_ID = 1L;

    @Override
    public SmsIntegrationSetting getIntegerSetting() {
        return integrationSettingMapper.selectByPrimaryKey(DEFAULT_INTEGRATION_SETTING_ID);
    }

    @Override
    public int updateIntegrationSetting(SmsIntegrationSetting integrationSetting) {
        return integrationSettingMapper.updateByPrimaryKeySelective(integrationSetting);
    }

    @Override
    public UmsIntegrationConsumeSetting getIntegerConsumeSetting() {
        return integrationConsumeSettingMapper.selectByPrimaryKey(DEFAULT_INTEGRATION_SETTING_ID);
    }

    @Override
    public int updateIntegrationConsumeSetting(UmsIntegrationConsumeSetting integrationConsumeSetting) {
        return integrationConsumeSettingMapper.updateByPrimaryKeySelective(integrationConsumeSetting);
    }
}
